package com.liuzh.deviceinfo.appinfo;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.text.format.Formatter;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout.LayoutParams;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AlertController;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager.widget.ViewPager.h;
import b.l.a.n;
import c.h.a.b0.m;
import c.h.a.b0.o;
import c.h.a.m0.i;
import c.h.a.x.p;
import c.h.a.x.q;
import c.h.a.x.r;
import c.h.a.x.t.g;
import c.h.a.x.t.j;
import c.h.a.x.t.k;
import c.h.a.x.t.l;
import com.liuzh.deviceinfo.base.BaseActivity;
import com.liuzh.deviceinfo.pro.ProActivity;
import java.io.File;
import java.util.Objects;

public class AppInfoActivity extends BaseActivity implements c.h.a.f0.j.a {
    public static final /* synthetic */ int u = 0;
    public c.h.a.x.t.d q;
    public j r;
    public n s;
    public boolean t = true;

    public class b implements h {
        public void a(int i, float f, int i2) {
        }

        public void b(int i) {
        }

        public void c(int i) {
            AppInfoActivity appInfoActivity = AppInfoActivity.this;
            appInfoActivity.E(k.a(appInfoActivity.q.a.keyAt(i)));
        }
    }

    public class c extends c.h.b.a.a.b {
        public final /* synthetic */ ViewGroup a;

        public c(ViewGroup viewGroup) {
            this.a = viewGroup;
        }

        public void b() {
            c.f.a.a.a.a.z("ad_appinfo");
        }

        public void c(String str) {
            AppInfoActivity appInfoActivity = AppInfoActivity.this;
            int i = AppInfoActivity.u;
            Objects.requireNonNull(appInfoActivity);
            ProActivity.G(appInfoActivity);
            appInfoActivity.C();
        }

        public void d(String str) {
            c.f.a.a.a.a.x("ad_appinfo", str);
            AppInfoActivity appInfoActivity = AppInfoActivity.this;
            int i = AppInfoActivity.u;
            appInfoActivity.C();
        }

        public void e(View view) {
            i iVar = i.a;
            iVar = i.a;
            if (!i.b()) {
                this.a.setVisibility(0);
                this.a.removeAllViews();
                this.a.addView(view, new LayoutParams(-2, -2, 17));
            }
        }
    }

    public class d implements c.h.a.m0.n {
        public final /* synthetic */ m a;
        public final /* synthetic */ String b;

        public d(m mVar, String str) {
            this.a = mVar;
            this.b = str;
        }

        public void a() {
            this.a.m0(false, false);
            Toast.makeText(AppInfoActivity.this, 2131689838, 0).show();
        }

        public void onSuccess() {
            if (!c.h.a.m0.h.q(AppInfoActivity.this)) {
                this.a.m0(false, false);
                String path = new File(r.c, this.b).getPath();
                b.b.c.f.a aVar = new b.b.c.f.a(AppInfoActivity.this);
                aVar.e(2131690257);
                aVar.a.f = AppInfoActivity.this.getString(2131689965, new Object[]{path});
                aVar.d(17039370, null);
                aVar.b(17039361, new c.h.a.x.d(this, path));
                aVar.g();
            }
        }
    }

    public class e implements c.h.a.x.r.a {
        public String a;
        public final /* synthetic */ f b;
        public final /* synthetic */ String c;

        public e(f fVar, String str) {
            this.b = fVar;
            this.c = str;
        }

        public void a() {
            this.b.m0(false, false);
            Toast.makeText(AppInfoActivity.this, 2131689838, 0).show();
        }

        public void b(long j, long j2) {
            if (this.a == null) {
                this.a = Formatter.formatFileSize(AppInfoActivity.this, j2);
            }
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append(Formatter.formatFileSize(AppInfoActivity.this, j));
            stringBuilder.append("/");
            stringBuilder.append(this.a);
            String stringBuilder2 = stringBuilder.toString();
            Dialog dialog = this.b.e0;
            if (dialog != null && dialog.isShowing()) {
                this.b.s0(stringBuilder2);
            }
            if (j == j2) {
                this.b.r0(new File(r.a, this.c).getPath());
            }
        }

        public boolean stop() {
            return this.b.j0;
        }
    }

    public class a extends n {
        public a(b.l.a.h hVar, int i) {
            super(hVar, i);
        }

        public int c() {
            c.h.a.x.t.d dVar = AppInfoActivity.this.q;
            if (dVar == null) {
                return 0;
            }
            return dVar.a.size();
        }

        public CharSequence e(int i) {
            return ((l) AppInfoActivity.this.q.a.valueAt(i)).a();
        }

        public Object f(ViewGroup viewGroup, int i) {
            if (this.e == null) {
                b.l.a.i iVar = (b.l.a.i) this.c;
                Objects.requireNonNull(iVar);
                this.e = new b.l.a.a(iVar);
            }
            long j = (long) i;
            Fragment b = this.c.b(n.m(viewGroup.getId(), j));
            if (b != null) {
                this.e.b(new b.l.a.p.a(7, b));
            } else {
                b = ((l) AppInfoActivity.this.q.a.valueAt(i)).b();
                this.e.f(viewGroup.getId(), b, n.m(viewGroup.getId(), j), 1);
            }
            if (b != this.f) {
                b.g0(false);
                if (this.d == 1) {
                    this.e.h(b, b.n.d.b.STARTED);
                } else {
                    b.k0(false);
                }
            }
            c.h.a.x.t.d dVar = AppInfoActivity.this.q;
            if (dVar == null) {
                return b;
            }
            if (b instanceof c.h.a.x.t.j.a) {
                j jVar = (j) dVar.a(0);
                if (jVar != null) {
                    c.h.a.x.t.j.a aVar = (c.h.a.x.t.j.a) b;
                    aVar.W = jVar;
                    aVar.m0();
                }
            } else if (b instanceof c.h.a.x.t.f.a) {
                c.h.a.x.t.f fVar = (c.h.a.x.t.f) dVar.a(1);
                if (fVar != null) {
                    c.h.a.x.t.f.a aVar2 = (c.h.a.x.t.f.a) b;
                    aVar2.W = fVar;
                    View view = aVar2.X;
                    if (view != null) {
                        fVar.c((LinearLayout) view.findViewById(2131296476));
                    }
                }
            } else if (b instanceof c.h.a.x.t.c.a) {
                c.h.a.x.t.c cVar = (c.h.a.x.t.c) dVar.a(2);
                if (cVar != null) {
                    c.h.a.x.t.c.a aVar3 = (c.h.a.x.t.c.a) b;
                    aVar3.W = cVar;
                    if (aVar3.X != null) {
                        c.h.a.x.t.c.a.b bVar = aVar3.Z;
                        if (bVar != null) {
                            bVar.a.b();
                        }
                    }
                }
            } else if (b instanceof c.h.a.x.t.n.b) {
                c.h.a.x.t.n nVar = (c.h.a.x.t.n) dVar.a(3);
                if (nVar != null) {
                    c.h.a.x.t.n.b bVar2 = (c.h.a.x.t.n.b) b;
                    bVar2.W = nVar;
                    if (bVar2.X != null) {
                        c.h.a.x.t.n.b.b bVar3 = bVar2.Z;
                        if (bVar3 != null) {
                            bVar3.a.b();
                        }
                    }
                }
            } else if (b instanceof c.h.a.x.t.g.a) {
                g gVar = (g) dVar.a(4);
                if (gVar != null) {
                    c.h.a.x.t.g.a aVar4 = (c.h.a.x.t.g.a) b;
                    aVar4.W = gVar;
                    if (aVar4.X != null) {
                        c.h.a.x.t.g.a.b bVar4 = aVar4.Z;
                        if (bVar4 != null) {
                            bVar4.a.b();
                        }
                    }
                }
            } else if (b instanceof c.h.a.x.t.e.a) {
                c.h.a.x.t.e eVar = (c.h.a.x.t.e) dVar.a(5);
                if (eVar != null) {
                    c.h.a.x.t.e.a aVar5 = (c.h.a.x.t.e.a) b;
                    aVar5.W = eVar;
                    if (aVar5.X != null) {
                        c.h.a.x.t.e.a.b bVar5 = aVar5.Z;
                        if (bVar5 != null) {
                            bVar5.a.b();
                        }
                    }
                }
            } else if (b instanceof c.h.a.x.t.i.a) {
                c.h.a.x.t.i iVar2 = (c.h.a.x.t.i) dVar.a(6);
                if (iVar2 != null) {
                    c.h.a.x.t.i.a aVar6 = (c.h.a.x.t.i.a) b;
                    aVar6.W = iVar2;
                    if (aVar6.X != null) {
                        c.h.a.x.t.i.a.b bVar6 = aVar6.Z;
                        if (bVar6 != null) {
                            bVar6.a.b();
                        }
                    }
                }
            } else if (b instanceof c.h.a.x.t.h.a) {
                c.h.a.x.t.h hVar = (c.h.a.x.t.h) dVar.a(7);
                if (hVar != null) {
                    c.h.a.x.t.h.a aVar7 = (c.h.a.x.t.h.a) b;
                    aVar7.W = hVar;
                    if (aVar7.X != null) {
                        c.h.a.x.t.h.a.b bVar7 = aVar7.Z;
                        if (bVar7 != null) {
                            bVar7.a.b();
                        }
                    }
                }
            } else if (b instanceof c.h.a.x.t.m.a) {
                c.h.a.x.t.m mVar = (c.h.a.x.t.m) dVar.a(8);
                if (mVar != null) {
                    c.h.a.x.t.m.a aVar8 = (c.h.a.x.t.m.a) b;
                    aVar8.W = mVar;
                    if (aVar8.X != null) {
                        c.h.a.x.t.m.a.b bVar8 = aVar8.Z;
                        if (bVar8 != null) {
                            bVar8.a.b();
                        }
                    }
                }
            }
            return b;
        }
    }

    public static class f extends b.l.a.b {
        public static final /* synthetic */ int k0 = 0;
        public String i0;
        public boolean j0;

        public static f q0(b.l.a.h hVar, String str) {
            f fVar = new f();
            Bundle bundle = new Bundle();
            bundle.putString("progress", str);
            fVar.e0(bundle);
            fVar.p0(hVar, fVar.toString());
            fVar.o0(false);
            return fVar;
        }

        public void Q(Bundle bundle) {
            super.Q(bundle);
            bundle.putString("progress", this.i0);
        }

        public Dialog n0(Bundle bundle) {
            Bundle bundle2 = this.f;
            String str = "progress";
            if (bundle2 != null) {
                this.i0 = bundle2.getString(str);
            }
            if (bundle != null) {
                String string = bundle.getString(str);
                if (!TextUtils.isEmpty(string)) {
                    this.i0 = string;
                }
            }
            b.b.c.f.a aVar = new b.b.c.f.a(Z());
            aVar.e(2131689832);
            aVar.a.f = this.i0;
            aVar.b(2131690402, new c.h.a.x.f(this));
            aVar.a.m = false;
            return aVar.a();
        }

        public void r0(String str) {
            if (!c.h.a.m0.h.q(e())) {
                FragmentActivity Y = Y();
                b.b.c.f.a aVar = new b.b.c.f.a(Y);
                aVar.e(2131689830);
                aVar.a.f = Y.getString(2131689964, new Object[]{str});
                aVar.d(17039370, null);
                aVar.b(17039361, null);
                aVar.c(2131690352, null);
                b.b.c.f g = aVar.g();
                g.c(-2).setOnClickListener(new c.h.a.x.g(Y, str));
                g.c(-3).setOnClickListener(new c.h.a.x.e(Y, str));
                g.setCanceledOnTouchOutside(false);
                m0(false, false);
            }
        }

        public void s0(String str) {
            this.i0 = str;
            b.b.c.f fVar = (b.b.c.f) this.e0;
            if (fVar != null && fVar.isShowing()) {
                String str2 = this.i0;
                AlertController alertController = fVar.c;
                alertController.f = str2;
                TextView textView = alertController.F;
                if (textView != null) {
                    textView.setText(str2);
                }
            }
        }
    }

    public static void F(Context context, String str) {
        Intent intent = new Intent(context, AppInfoActivity.class);
        intent.putExtra("pkg", str);
        context.startActivity(intent);
    }

    public final void A() {
        StringBuilder g = c.b.a.a.a.g("0/");
        g.append(this.r.o);
        String stringBuilder = g.toString();
        int i = f.k0;
        f q0 = f.q0(o(), stringBuilder);
        j jVar = this.r;
        File file = r.a;
        String a = r.a(jVar.b, jVar.e);
        c.h.a.m0.p.a.a(new q(this.r.l, new e(q0, a), a));
    }

    public final void B() {
        i iVar = i.a;
        iVar = i.a;
        if (i.b()) {
            C();
            return;
        }
        ViewGroup viewGroup = (ViewGroup) findViewById(2131296331);
        if (!c.f.a.a.a.a.u()) {
            c.f.a.a.a.a.y("ad_appinfo");
            c.h.b.a.a.c.a(this, c.h.a.u.a.d, new c(viewGroup));
        }
    }

    public final void C() {
        ViewGroup viewGroup = (ViewGroup) findViewById(2131296331);
        viewGroup.setVisibility(8);
        viewGroup.removeAllViews();
        findViewById(2131297067).setVisibility(8);
    }

    public final void D() {
        Drawable drawable = this.r.r;
        if (drawable == null) {
            Toast.makeText(this, 2131689838, 0).show();
            return;
        }
        m q0 = m.q0(this);
        j jVar = this.r;
        File file = r.a;
        String b = r.b(jVar.b, jVar.e);
        c.h.a.m0.p.a.a(new p(drawable, new d(q0, b), b));
    }

    public final void E(String str) {
        if (str != null) {
            c.h.a.v.a aVar = c.h.a.v.a.b;
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("AppinfoTab_");
            stringBuilder.append(str);
            aVar.c(stringBuilder.toString(), null);
        }
    }

    public void i(boolean z) {
        if (z) {
            C();
        } else {
            B();
        }
    }

    public void onBackPressed() {
        if (this.t) {
            i iVar = i.a;
            iVar = i.a;
            SharedPreferences sharedPreferences = i.b;
            if (sharedPreferences.getBoolean("can_show_rate_dialog", true) && sharedPreferences.getInt("enter_appinfo_count", 0) == 3) {
                this.t = false;
                new c.h.a.b0.n(this).a();
                return;
            }
        }
        this.e.a();
    }

    /* JADX WARNING: Removed duplicated region for block: B:11:0x0035  */
    /* JADX WARNING: Removed duplicated region for block: B:9:0x0027  */
    public void onCreate(android.os.Bundle r5) {
        /*
        r4 = this;
        super.onCreate(r5);
        r5 = r4.getIntent();
        r0 = "pkg";
        r5 = r5.getStringExtra(r0);
        r0 = c.h.a.m0.h.a;
        r0 = android.text.TextUtils.isEmpty(r5);
        r1 = 0;
        r2 = 1;
        if (r0 == 0) goto L_0x0018;
    L_0x0017:
        goto L_0x0024;
    L_0x0018:
        r0 = r4.getPackageManager();	 Catch:{ NameNotFoundException -> 0x0024 }
        r0 = r0.getPackageInfo(r5, r1);	 Catch:{ NameNotFoundException -> 0x0024 }
        if (r0 == 0) goto L_0x0024;
    L_0x0022:
        r0 = 1;
        goto L_0x0025;
    L_0x0024:
        r0 = 0;
    L_0x0025:
        if (r0 != 0) goto L_0x0035;
    L_0x0027:
        r5 = 2131689507; // 0x7f0f0023 float:1.9008031E38 double:1.053194553E-314;
        r5 = android.widget.Toast.makeText(r4, r5, r1);
        r5.show();
        r4.finish();
        return;
    L_0x0035:
        r0 = 2131492908; // 0x7f0c002c float:1.8609281E38 double:1.05309742E-314;
        r4.setContentView(r0);
        r0 = 2131297061; // 0x7f090325 float:1.8212056E38 double:1.053000659E-314;
        r0 = r4.findViewById(r0);
        r0 = (androidx.appcompat.widget.Toolbar) r0;
        r3 = 2131231049; // 0x7f080149 float:1.8078168E38 double:1.0529680447E-314;
        r3 = r4.getDrawable(r3);
        r0.setOverflowIcon(r3);
        r3 = r4.s();
        r3.x(r0);
        r4.z();
        r0 = new c.h.a.x.h;
        r0.m2158init(r4, r5);
        r5 = c.h.a.m0.p.a.a;
        r5 = c.h.a.m0.p.a.c;	 Catch:{ RejectedExecutionException -> 0x0065 }
        r5.execute(r0);	 Catch:{ RejectedExecutionException -> 0x0065 }
        goto L_0x0066;
    L_0x0066:
        r5 = 2131297333; // 0x7f090435 float:1.8212608E38 double:1.0530007933E-314;
        r5 = r4.findViewById(r5);
        r5 = (androidx.viewpager.widget.ViewPager) r5;
        r0 = new com.liuzh.deviceinfo.appinfo.AppInfoActivity$a;
        r3 = r4.o();
        r0.m8388init(r3, r2);
        r4.s = r0;
        r5.setAdapter(r0);
        r0 = 2131297016; // 0x7f0902f8 float:1.8211965E38 double:1.0530006367E-314;
        r0 = r4.findViewById(r0);
        r0 = (com.google.android.material.tabs.TabLayout) r0;
        r0.m(r5, r2, r1);
        r0 = new com.liuzh.deviceinfo.appinfo.AppInfoActivity$b;
        r0.m7653init();
        r2 = r5.R;
        if (r2 != 0) goto L_0x0099;
    L_0x0092:
        r2 = new java.util.ArrayList;
        r2.<init>();
        r5.R = r2;
    L_0x0099:
        r5 = r5.R;
        r5.add(r0);
        r5 = c.h.a.x.t.k.a(r1);
        r4.E(r5);
        r4.B();
        r5 = c.h.a.m0.i.a;
        r5 = c.h.a.m0.i.a;
        r5 = c.h.a.m0.i.b;
        r0 = "enter_appinfo_count";
        r1 = r5.getInt(r0, r1);
        r2 = 2147483647; // 0x7fffffff float:NaN double:1.060997895E-314;
        if (r1 >= r2) goto L_0x00bb;
    L_0x00b9:
        r1 = r1 + 1;
    L_0x00bb:
        c.b.a.a.a.o(r5, r0, r1);
        r5 = c.h.a.f0.j.d;
        r5.h(r4);
        return;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.liuzh.deviceinfo.appinfo.AppInfoActivity.onCreate(android.os.Bundle):void");
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        menu.add(0, 1, 1, 2131690553).setShowAsAction(0);
        menu.add(0, 2, 2, 2131690353).setShowAsAction(0);
        menu.add(0, 3, 3, 2131689825).setShowAsAction(0);
        menu.add(0, 4, 4, 2131690554).setShowAsAction(0);
        menu.add(0, 5, 5, 2131690256).setShowAsAction(0);
        menu.add(0, 6, 6, 2131690357).setShowAsAction(0);
        menu.add(0, 7, 7, 2131690513).setShowAsAction(0);
        return super.onCreateOptionsMenu(menu);
    }

    public void onDestroy() {
        super.onDestroy();
        c.h.a.f0.j.d.j(this);
    }

    public boolean onOptionsItemSelected(MenuItem menuItem) {
        int itemId = menuItem.getItemId();
        if (itemId == 16908332) {
            finish();
            return true;
        }
        j jVar = this.r;
        if (jVar == null) {
            Toast.makeText(this, 2131689838, 0).show();
            finish();
            return true;
        } else if (itemId == 1) {
            c.h.a.m0.h.n(this, jVar.b);
            return true;
        } else if (itemId == 6) {
            c.h.a.m0.h.m(this, jVar.b);
            return true;
        } else if (itemId != 2) {
            String str = "android.permission.WRITE_EXTERNAL_STORAGE";
            if (itemId == 3) {
                if (c.h.a.e0.a.b(this, str)) {
                    A();
                } else {
                    b.i.b.a.c(this, new String[]{str}, 17);
                }
                return true;
            } else if (itemId == 4) {
                String str2 = jVar.b;
                File file = r.a;
                String c = r.c(str2, jVar.e);
                Intent intent = new Intent(this, ManifestActivity.class);
                intent.putExtra("pkg", str2);
                intent.putExtra("fileName", c);
                startActivity(intent);
                return true;
            } else if (itemId == 5) {
                if (c.h.a.e0.a.b(this, str)) {
                    D();
                } else {
                    b.i.b.a.c(this, new String[]{str}, 34);
                }
                return true;
            } else if (itemId != 7) {
                return super.onOptionsItemSelected(menuItem);
            } else {
                c.h.a.m0.h.x(this, jVar.b);
                return true;
            }
        } else {
            r.d(this, jVar.l);
            return true;
        }
    }

    public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
        super.onRequestPermissionsResult(i, strArr, iArr);
        if (!c.h.a.e0.a.f(iArr)) {
            String str = "android.permission.WRITE_EXTERNAL_STORAGE";
            int i2;
            if (i == 17) {
                if (!c.h.a.e0.a.c(this, str)) {
                    i2 = o.i0;
                    o.r0(o(), 2131690076, 2131689826);
                }
            } else if (i == 34 && !c.h.a.e0.a.c(this, str)) {
                i2 = o.i0;
                o.r0(o(), 2131690076, 2131690255);
            }
        } else if (i == 17) {
            A();
        } else if (i == 34) {
            D();
        }
    }

    public boolean y() {
        return false;
    }
}
